package com.example.service.impl;

import com.example.mapper.workProjectMapp;
import com.example.pojo.workProjectPojo;
import com.example.service.workProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * ClassName:workProjectlmpl
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/6/19 18:38
 * @Version 1.0
 */
@Service//注解：表示把这个注入到了ben中。
@Slf4j//可以输出注解
public class workProjectImpl implements workProjectService {
    @Autowired
    private workProjectMapp workProjectMapp;
    //向数据库中插入一行空数据
    public void insertWorkOne(workProjectPojo workProjectPojo){
        //组合创建时间
        workProjectPojo.setEstablishTime(LocalDateTime.now());
        workProjectPojo.setUpdateTime(LocalDateTime.now());
        workProjectMapp.insertWorkOne(workProjectPojo);
    }
    //查询所有的数据

     public List<workProjectPojo> queryAll(){
        List<workProjectPojo> list=workProjectMapp.queryAll();
        return list;
     }
    //修改某一个字段，传入的是修改字符串的类型
    public void saveWorkProjectOneStr(Map<String, Object> parameters){
        Integer idUse = (Integer) parameters.get("idUse");
        String field = (String) parameters.get("field");
        String val = (String) parameters.get("val");
        workProjectMapp.saveWorkProjectOneStr(idUse,field,val);
    }
    //修改某一个字段，传入的是修改字符串的类型
    public void saveWorkProjectOneNmb(Map<String, Object> parameters){
        Integer idUse = (Integer) parameters.get("idUse");
        String field = (String) parameters.get("field");
        Integer val = (Integer) parameters.get("val");
        workProjectMapp.saveWorkProjectOneNmb(idUse,field,val);
    }
}
